home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh -e
-
- if [ "$1" = remove ]; then
- # We must do some checking to prevent removal of ecryptfs if in use
- # Check active mounts
- if out=`mount | grep "\Wtype\Wecryptfs\W"`; then
- echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
- echo "$out" 1>&2
- exit 1
- fi
- if out=`grep "\Wecryptfs\W" /proc/mounts`; then
- echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
- echo "$out" 1>&2
- exit 1
- fi
- # Check fstab
- if out=`grep "\Wecryptfs\W" /etc/fstab`; then
- echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
- echo "$out" 1>&2
- exit 1
- fi
- # Check home directories
- for i in `ls /home`; do
- if [ -d "/home/$i/.ecryptfs" ]; then
- # If we find a .ecryptfs directory (or link) in a home,
- # directory, then someone is using ecryptfs-utils, and
- # we should not allow package removal
- echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
- echo " [/home/$i/.ecryptfs]" 1>&2
- exit 1
- fi
- done
- pam-auth-update --package --remove ecryptfs-utils
- fi
-
-
-
- exit 0
-